<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="../script/jquery-1.7.2.js"></script>
    <script type="text/javascript">
        $(function () {
            //attr
            //alert($(":checkbox:first").attr("name"));//获取
            //$(":checkbox:first").attr("name", "abc");//设置

            //alert($(":checkbox").attr("checked"));//官方觉得返回undefined是一个错误
            alert($(":checkbox:nth-child(2)").prop("checked", true));
        })
    </script>
</head>
<body>

    多选：
    <input name="checkbox" type="checkbox" value="checkbox1" />checkbox1
    <input name="checkbox" type="checkbox" value="checkbox2" />checkbox2
    <input name="checkbox" type="checkbox" value="checkbox3" />checkbox3

</body>
</html>